package com.yc.favorite.mapper;

import com.yc.favorite.po.TagFavorite;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;

public interface TagFavoriteMapper {

    @Insert("insert into tagfavorite values (#{tid},#{fid})")
    int insert(TagFavorite tagFavorite);

    @Insert("insert into tagfavorite\n" +
            "SELECT\n" +
            "	(\n" +
            "		SELECT\n" +
            "			tid\n" +
            "		FROM\n" +
            "			tag\n" +
            "		WHERE\n" +
            "			tname = #{tname}\n" +
            "	),\n" +
            "	a.fid\n" +
            "FROM\n" +
            "	favorite a\n" +
            "WHERE\n" +
            "	a.fid = #{fid}")
    int insert1(@Param("tname") String tname, @Param("fid") int fid);


}
